#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <string>
#include <set>
using namespace std;
class cmp
{
public:
    bool operator()(int val)
    {
//        return to_string(val).size()==2;
        return to_string(val).find("7")!=-1;
    }
};
int main_2()
{
    srand((unsigned int)time(NULL));
    vector<int> v1;
    multiset<int> ms;
    int random_int;
    int stop=rand()%100+1;
    for (int i=0; i<stop ; i++ )
    {
        random_int=rand()%10;
        v1.push_back(random_int);
        ms.insert(random_int);
    }
    for (int i=0; i<stop ; i++ )
    {
        cout << v1.at(i) << " ";
    }
    cout  << endl;
    int num=count_if(v1.begin(),v1.end(),cmp());
    cout << "The number of elements including 7 is "<<num << endl;
    num=count_if(v1.begin(),v1.end(),bind2nd(greater<int>(),90));//adapter
    cout << "The number of elements greater than 90 is "<<num << endl;
    num=count_if(v1.begin(),v1.end(),not1(bind2nd(modulus<int>(),2)));//adapter
    cout << "The number of even elements  is "<<num << endl;
    for (multiset<int>::const_iterator it=ms.begin(); it!=ms.end() ; it++ )
    {
        cout << *it << " ";
    }
    cout  << endl;
    int target=4;
    num=count(ms.begin(),ms.end(),target);
    cout << "The number of "<<target<<" is "<<num << endl;
    num=ms.count(target);
    cout << "The number of "<<target<<" is "<<num << endl;
    int n=distance(ms.begin(),ms.end());
    cout << "The distance of two pointers is "<<n << endl;
    return 0;
}
